﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace HomeWork
{

    internal class ProblemRepository : IRepository<Problem>
    {
        //找出每一篇求助的悬赏都大于5个帮帮币的求助作者
        public IEnumerable<User> GetRewardAuthor()
        {
            var authors = entities.GroupBy(a => a.Author);
            
        return authors // 按作者分组
        .Where(g => g.All(p => p.Reward > 5)) // 确保组内每篇文章的悬赏都大于5
        .Select(g => g.Key).Distinct().ToList(); // 将分组展平为IEnumerable<Problem>

        }
    }
}
